package com.redis;

import cn.hserver.plugin.web.annotation.Controller;
import cn.hserver.plugin.web.annotation.GET;
import org.redisson.api.RBucket;
import org.redisson.api.RedissonClient;
import cn.hserver.core.ioc.annotation.Autowired;

@Controller
public class Action {

    @Autowired
    private RedissonClient redissonClient;


    @GET("/get")
    public String get() {
        Object user = redissonClient.getBucket("user").get();
        return String.valueOf(user);
    }

    @GET("/set")
    public String set() {
        RBucket<Object> user = redissonClient.getBucket("user");
        user.set("reids测试");
        return "ok";
    }

    @GET("/getStr")
    public String getStr() {
        return "reids测试Str";
    }

}
